package com.cn.xiaonuo.slbfinances.slborders.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cn.xiaonuo.slbfinances.shopassets.entity.SlMerchantAssets;
import com.cn.xiaonuo.slbfinances.shopassets.param.PageRefundDetailParam;
import com.cn.xiaonuo.slbfinances.shopassets.rsp.RefundDetailRsp;
import com.cn.xiaonuo.slbfinances.shopassets.rsp.RevenueOrdersRsp;
import com.cn.xiaonuo.slbfinances.shopassets.rsp.ShopRefundDetailRsp;
import com.cn.xiaonuo.slbfinances.slborders.entity.SlOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface SlOrderMapper extends BaseMapper<SlOrder> {
    /**
     * 查询订单交易金额、积分收入总额、手续费
     * @param shopId
     * @param createTime
     * @return
     */
    SlMerchantAssets totalOrderAmount(@Param("shopId") Integer shopId, @Param("createTime") String createTime);

    /**
     * 微信支付合计
     * @param shopId
     * @param createTime
     * @return
     */
    SlMerchantAssets wechatTotalAmount(@Param("shopId") Integer shopId,@Param("createTime") String createTime);

    /**
     * 支付宝支付合计
     * @param id
     * @param createTime
     * @return
     */
    SlMerchantAssets alipayRevenue(@Param("shopId") Integer shopId,@Param("createTime") String createTime);

    /**
     * 当日合计收入
     * @param shopId
     * @param createTime
     * @return
     */
    SlMerchantAssets totalIncome(@Param("shopId") Integer shopId,@Param("createTime") String createTime);

    /**
     * 查询当日订单涉及的店铺
     * @param createTime
     * @return
     */
    List<Map<String,Object>> getSettlementShop(@Param("createTime") String createTime);

    /**
     * 分页查询退款明细
     * @param param
     * @return
     */
    List<RefundDetailRsp> pageRefundDetail(PageRefundDetailParam param);

    /**
     * （退款）订单合计金额
     * @param param
     * @return
     */
    ShopRefundDetailRsp sumOrderAmount(PageRefundDetailParam param);

    /**
     * （退款）微信支出
     * @param param
     * @return
     */
    Map<String, Object> sumWechatExpenditure(PageRefundDetailParam param);

    /**
     * （退款）支付宝支出
     * @param param
     * @return
     */
    Map<String, Object> sumAlipayExpenditure(PageRefundDetailParam param);

    List<Map<String, Object>> getPlaceOrderShop(String createTime);
}
